{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set script_controller = 'setting/theme' %}

{% set menu = 'admin_setting_theme' %}

{% block main %}

  <table class="table table-striped table-hover" id="theme-table">
    <thead>
    <tr>
      <th>{{'名称'|trans}}</th>
      <th width="10%">{{'主题版本'|trans}}</th>
      <th>{{'作者'|trans}}</th>
      <th>{{'操作'|trans}}</th>
    </tr>
    </thead>
    <tbody>
      {% for theme in themes %}
        <tr>
          <td>

            <div class="media">
              <img class="media-object pull-left" src="{{ asset('themes/' ~ theme.uri ~ '/' ~ theme.thumb) }}" width="150">
              <div class="media-body">
                <h5 class="media-heading">{{ theme.name }}</h5>
                {{ theme.description|default('')|raw }}
                {% if theme.setting|default(null) %}
                  <a href="../{{ theme.setting }}">{{'设置'|trans}}</a>
                {% endif %}
              </div>
            </div>
          </td>
          <td>{{ theme.version }}</td>
          <td>{{ theme.author }}</td>
          <td>
            {% if currentTheme.uri == theme.uri %}
              <span class="text-success">{{'当前正在使用该主题'|trans}}</span>
            {% else %}
              <button class="btn btn-default btn-sm use-theme-btn" data-url="{{ path('admin_setting_theme_change', {uri:theme.uri}) }}">{{'使用'|trans}}</button>
            {% endif %}
            {% if theme.uri == 'jianmo' and currentTheme.uri == 'jianmo' %}
            <a href="{{ path('admin_theme_manage', {uri:theme.uri}) }}"class="btn btn-primary" >{{'管理'|trans}}</a>
            {% endif %}
            {% if theme.uri == 'graceful' and currentTheme.uri == 'graceful' and version_compare(theme.version,'1.4.14','>=') %}
            <a href="{{ path('admin_theme_manage', {uri:theme.uri}) }}"class="btn btn-primary" >{{'管理'|trans}}</a>
            {% endif %}
          </td>
        </tr>
      {% endfor %}
    </tbody>
  </table>


{% endblock %}